﻿using server.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using System.Threading.Tasks;

namespace Restful
{
     [ServiceContract(Name = "ServiceImp")]
    public  interface IService
    {
        [OperationContract]
        [WebGet(UriTemplate = "SaveFence/{json}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        int Save(string json);

        /// <summary>
        /// 启动游戏
        /// </summary>
        /// <param name="grounpId"></param>
        /// <returns></returns>
        [OperationContract]
        [WebGet(UriTemplate = "StartGame/{grounpId}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string StartGame(string grounpId);
        /// <summary>
        /// 停止游戏
        /// </summary>
        /// <param name="grounpId"></param>
        /// <returns></returns>
        [OperationContract]
        [WebGet(UriTemplate = "StopGame/{grounpId}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string StopGame(string grounpId);

        [OperationContract]
        [WebGet(UriTemplate = "SearchGameStateByGrounp/{grounpId}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string SearchGameStateByGrounp(string grounpId);


        [OperationContract]
        [WebGet(UriTemplate = "SendChatMessage/{json}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string SendChatMessage(string json);

        [OperationContract]
        [WebGet(UriTemplate = "GetMessage/{userId}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string GetMessage(string userId);

        [OperationContract]
        [WebGet(UriTemplate = "Debug/{info}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string ShowDebug(string info);

      
        [OperationContract]
        [WebGet(UriTemplate = "SetPlayerReadyOk/{userId}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string SetPlayerReadyOk(string userId);

        [OperationContract]
        [WebGet(UriTemplate = "SetPlayerCancelReady/{userId}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string SetPlayerCancelReady(string userId);

        [OperationContract]
        [WebGet(UriTemplate = "SetLeaderReadyCancel/{userId}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string SetLeaderReadyCancel(string userId);

        [OperationContract]
        [WebGet(UriTemplate = "CheckGameRunState/{json}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        int CheckGameRunState(string json);

        [OperationContract]
        [WebGet(UriTemplate = "GetRoomList/{adminUserId}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string GetRoomList(string adminUserId);

        //[OperationContract]
        //[WebGet(UriTemplate = "SearchScoreByRoom/{roomId}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        //string SearchScoreByRoom(string roomId);


        [OperationContract]
        [WebGet(UriTemplate = "EditRoom/{roomId}/{userId}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        int  IsEditRoom(string roomId,string userId);

        [OperationContract]
        [WebGet(UriTemplate = "GetRoomUserTreeData/{userId}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string GetRoomUserTreeData(string userId);

        
        [OperationContract]
        [WebGet(UriTemplate = "GetRemainTime/{userId}/{userType}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string GetRemainTime(string userId,string userType);

        [OperationContract]
        [WebGet(UriTemplate = "GetRemainFireTime/{userId}/{userType}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string GetRemainFireTime(string userId, string userType);


        [OperationContract]
        [WebGet(UriTemplate = "IsFireTime/{userId}/{userType}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string IsFireTime(string userId, string userType);

      
        [OperationContract]
        [WebGet(UriTemplate = "GetLeaderAuthority/{userId}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string GetLeaderAuthority(string userId);

        [OperationContract]
        [WebGet(UriTemplate = "GetRoomByUser/{userId}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string GetRoomByUser(string userId);

        [OperationContract]
        [WebGet(UriTemplate = "ModifyUser/{userId}/{userName}/{oldPassword}/{newPassword}/{userType}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string ModifyUser(string userId, string userName, string oldPassword, string newPassword,string userType);

        [OperationContract]
        [WebGet(UriTemplate = "ForgetPassword/{telephone}/{newPassword}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string ForgetPassword(string telephone, string newPassword);


        //清除游戏的队友

        [OperationContract]
        [WebGet(UriTemplate = "ClearRoomList/{grounpId}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string ClearRoomList(string grounpId);

        [OperationContract]
        [WebGet(UriTemplate = "CheckPlayerIsJoinState/{userId}/{userType}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string CheckPlayerIsJoinState(string userId,string userType);


        [OperationContract]
        [WebGet(UriTemplate = "CREATE_EDIT_ROOM/{grounpId}/{gamePassword}/{roomId}/{roomName}/{roomPassword}/{userId}", 
            BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        DataResult CREATE_EDIT_ROOM(string grounpId, string gamePassword,string roomId, string roomName,string roomPassword,string userId);

        [OperationContract]
        [WebGet(UriTemplate = "JoinRoom/{checkCode}/{grounpId}/{roomId}/{userId}/{userName}",
            BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        DataResult JoinRoom(string checkCode, string grounpId, string roomId, string userId, string userName);

        [OperationContract]
        [WebGet(UriTemplate = "CheckGameReadyState/{grounpId}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string CheckGameReadyState(string grounpId);

        [OperationContract]
        [WebGet(UriTemplate = "CheckGameIsSetFinish/{grounpId}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string CheckGameIsSetFinish(string grounpId);

        [OperationContract]
        [WebGet(UriTemplate = "CheckRoomState/{UserId}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string CheckRoomState(string UserId);


        [OperationContract]
        [WebGet(UriTemplate = "ResetGameConfig/{grounpId}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string ResetGameConfig(string grounpId);


        [OperationContract]
        [WebGet(UriTemplate = "SaveGameTemplate/{grounpId}/{Name}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string SaveGameTemplate(string grounpId,string Name);


        [OperationContract]
        [WebGet(UriTemplate = "RestoreGameTemplate/{id}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string RestoreGameTemplate(string id);


        [OperationContract]
        [WebGet(UriTemplate = "DelGameTemplate/{id}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string DelGameTemplate(string id);


        [OperationContract]
        [WebGet(UriTemplate = "CheckGameTemplate/{grounpId}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string CheckGameTemplate(string grounpId);


        [OperationContract]
        [WebGet(UriTemplate = "GetGameTemplateList/{grounpId}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string GetGameTemplateList(string grounpId);

        [OperationContract]
        [WebGet(UriTemplate = "CopyGameTemplate/{id}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string CopyGameTemplate(string id);

        [OperationContract]
        [WebGet(UriTemplate = "UpdateGameTemplateName/{id}/{tname}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string UpdateGameTemplateName(string id,string  tname);

        [OperationContract]
        [WebInvoke(Method = "POST", UriTemplate = "SaveTestData", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        void SaveTestData(TestDataItem data);

    }
}
